import CommonIcon from '_c/common-icon'

import { showTitle } from '@/libs/util'

export default {
	components: {
		CommonIcon
	},

	methods: {
		showTitle(item) {
			return showTitle(item, this)
		},

		// 是否显示子菜单，有一个以上子菜单不隐藏就显示

		showChildren(item) {
			const flag =
				item.children &&
				item.children.filter((child) => {
					return child.meta && !child.meta.hideInMenu
				}).length > 1

			return flag
		},

		getNameOrHref(item, children0) {
			const name = item.href ? `isTurnByHref_${item.href}` : children0 ? item.children[0].name : item.name

			return name
		}
	}
}
